//
// Created by TNJ on 2021/6/15.
//

#ifndef BINARY_TREE_BINARY_TREE_H
#define BINARY_TREE_BINARY_TREE_H

typedef int data_type_t;

typedef struct binary_tree_node{
    data_type_t data;
    struct binary_tree_node *left;
    struct binary_tree_node *right;
}binary_tree_node_t;

extern binary_tree_node_t *new_binary_tree_node(data_type_t data);  //新建一个二叉树结点
extern void free_binary_tree_node(binary_tree_node_t *node);  //释放二叉树结点内存
extern void binary_tree_insert(binary_tree_node_t **root, data_type_t data);  //二叉查找树插入一个结点
extern void binary_tree_delete(binary_tree_node_t **root, data_type_t data);  //销毁二叉查找树
extern binary_tree_node_t *binary_tree_find(binary_tree_node_t *root, data_type_t data);  //在二叉查找树中查找一个结点
extern void binary_tree_destroy(binary_tree_node_t *root);  //销毁二叉树
extern void binary_tree_print(binary_tree_node_t *root);  //后序遍历打印
extern void preorder_traversal_binary_tree(binary_tree_node_t *root);  //前序遍历
extern void middle_order_traversal_binary_tree(binary_tree_node_t *root);  //中序遍历
extern void postorder_traversal_binary_tree(binary_tree_node_t *root);  //后序遍历

#endif //BINARY_TREE_BINARY_TREE_H
